Function Reference

RegDelete

Deletes a key or value from the registry.

RegDelete ( "keyname" [, "valuename"] )

 

Parameters

keyname The registry key to delete.
valuename [optional] The valuename to delete.

 

Return Value

Success: Returns 1.
Special: Returns 0 if the key/value does not exist.
Failure: Returns 2 if error deleting key/value.
@error can be set to following values :
1 if unable to open requested key
2 if unable to open requested main key
3 if unable to remote connect to the registry
-1 if unable to delete requested value
-2 if unable to delete requested key/value

 

Remarks

A registry key must start with "HKEY_LOCAL_MACHINE" ("HKLM") or "HKEY_USERS" ("HKU") or "HKEY_CURRENT_USER" ("HKCU") or "HKEY_CLASSES_ROOT" ("HKCR") or "HKEY_CURRENT_CONFIG" ("HKCC").

When running on 64-bit Windows if you want to delete a key or value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64.

To access the (Default) value use "" (a blank string) for the valuename.

Deleting from the registry is potentially dangerous--please exercise caution!

It is possible to access remote registries by using a keyname in the form "\\computername\keyname". To use this feature you must have the correct access rights on NT/2000/XP/2003, or if you are using a 9x based OS the remote PC must have the remote registry service installed first (See Microsoft Knowledge Base Article - 141460).

 

Related

RegRead, RegWrite

 

Example


RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE", "TestKey")